/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

var count=0;
chrome.browserAction.onClicked.addListener(function () {
    count++;
    chrome.browserAction.setBadgeText({text:''+count});
    //chrome.browserAction.setTitle({title:"google"})
    chrome.tabs.query({active:true,currentWindow:true},function (tabs) {
        console.log(tabs[0]);
        var title =encodeURIComponent(tabs[0].title);
         var url =encodeURIComponent(tabs[0].url);
         
         var target_url="https://gochannel.org/links/index.php?r=link/create&Link[url]="
                 +url+"&Link[title]="+title+"&appkey=chrome";
        chrome.tabs.create({url:target_url});
    })
});
 